const mongoose=require('./db.js')
let Shangtype=new mongoose.Schema({
    cai_name:String
})
const Shangtypemodel=mongoose.model('shangtype',Shangtype)
let Pei=new mongoose.Schema({
    p_name:String
})
const Peimodel=mongoose.model('pei',Pei)
let Dianpu=new mongoose.Schema({
    img:String,
    name:String,
    Km:{
        type:Number,
        default:0
    },
    diqu:String,
    cai_type:{
        type:mongoose.ObjectId,
        ref:'shangtype'
    },
    pei_type:{
        type:mongoose.ObjectId,
        ref:'pei'
    }
})
const Dianpumodel=mongoose.model('dianpu',Dianpu)
let Type=new mongoose.Schema({
    name:String
})
const Typemodel=mongoose.model('type',Type)
let Food=new mongoose.Schema({
    img:String,
    name:String,
    num:{type:Number,default:0},
    price:Number,
    dian:{type:mongoose.ObjectId,ref:'dianpu'},
    type:{type:mongoose.ObjectId,ref:'type'}
})
const Foodmodel=mongoose.model('food',Food)
module.exports={Shangtypemodel,Peimodel,Dianpumodel,Typemodel,Foodmodel}